package com.diycode.enumPackge;

import java.util.stream.Stream;

public enum UserTypeEnum {
    Type_1(1, "管理员"),
    Type_2(2, "业务员");
    private int type;
    private String des;

    public static UserTypeEnum getByType(int type) {
        return Stream.of(UserTypeEnum.values()).filter(item -> item.type == type).findFirst().orElse(null);
    }

    UserTypeEnum(int type, String des) {
        this.type = type;
        this.des = des;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }
}
